﻿using System;

namespace PrimeFactor
{
    class Program
    {
        public static bool IsPrimeNum(int n)
        {
            if (n < 2)
            {
                return false;
            }
            for(int i = 2; i < n; i++)
            {
                if (n % i == 0)
                    return false;
            }
            return true;
        }
        static void Main(string[] args)
        {
            int number;
            int eachFac;
            Console.WriteLine("Please enter a number:");
            number = int.Parse(Console.ReadLine());
            Console.WriteLine("All the prime factors of this number:");
            for(int i = 2; i <=number; i++)
            {
                eachFac = i;
                while((number % eachFac) == 0)
                {
                    if (IsPrimeNum(eachFac))
                    {
                        Console.WriteLine(eachFac);
                        number /= eachFac;
                    }
                }
            }
            
        }
    }
}
